"""
@Filename       : deep_cas.py
@Create Time    : 2020/11/2 16:01
@Author         : Rylynn
@Description    : 

"""

import torch
import torch.nn as nn
import dgl

class DeepCas(nn.Module):
    def __init__(self, config):
        super(DeepCas, self).__init__()
        self.node_embed = nn.Embedding(num_embeddings=config['nodes_num'], embedding_dim=config['embed_size'])
        self.bi_gru = nn.GRU(input_size=config['embed_size'],
                             hidden_size=config['hidden_size'],
                             batch_first=True,
                             bidirectional=True)

        self.linear = nn.Linear(in_features=config['hidden_size'], out_features=config['output_size'])

    def forward(self):
        pass


    def cascade_loss(self, pred_size, real_size):
        return torch.mean(torch.pow(torch.log2(pred_size + 1) - torch.log2(real_size + 1), 2))

    def user_loss(self, pred_user, real_user):
        return torch.softmax(pred_user, real_user)


def train_deepcas():
    deepcas = DeepCas(config=None)
    pass